﻿<UserControl x:Class="CinchCodeGen.PropertiesView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:CinchCodeGen"
    Height="Auto" Width="Auto">

    <UserControl.Resources>

        <!-- PropertiesViewModel -->
        <DataTemplate DataType="{x:Type local:SinglePropertyViewModel}">
            <AdornerDecorator>
                <local:SinglePropertyView />
            </AdornerDecorator>
        </DataTemplate>

    </UserControl.Resources>

    <Grid Background="Black"
      HorizontalAlignment="Stretch" 
      VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid Background="Black" Grid.Row="0">

            <Grid.RowDefinitions>
                <RowDefinition Height="45"/>
                <RowDefinition Height="4"/>
            </Grid.RowDefinitions>

            <Label FontFamily="Arial" FontSize="13" Grid.Row="0"
               Content="Manage ViewModel Properties" Margin="5"
               VerticalAlignment="Center" Foreground="#FFEF6803"
               FontStyle="Italic" FontWeight="Bold"
               HorizontalAlignment="Left"/>

            <StackPanel Orientation="Horizontal" 
                Grid.Row="0"
                HorizontalAlignment="Right">
                
                <Button Tag="../../Images/Add.png" Width="40" Height="40"  
                    Style="{StaticResource imageButtons}" Margin="5,0,5,5"
                    Command="{Binding Path=AddNewPropertyCommand}"
                    ToolTip="Add New Property To ViewModel" />
                <Button Tag="../../Images/Edit.png" Width="40" Height="40" 
                    Style="{StaticResource imageButtons}" Margin="5,0,5,5"
                    Command="{Binding Path=EditPropertiesCommand}"
                    ToolTip="Edit Available Property Types"/>
                <Button Tag="../../Images/dll.png" Width="40" Height="40" 
                    Style="{StaticResource imageButtons}" Margin="5,0,5,5"
                    Command="{Binding Path=EditReferencedAssembliesCommand}"
                    ToolTip="Edit Referenced Assemblies"/>

            </StackPanel>

            <Rectangle x:Name="rect" Grid.Row="1"
                    HorizontalAlignment="Stretch" 
                    VerticalAlignment="Stretch" Fill="#FFEF6803"/>
        </Grid>

        <Border CornerRadius="5" Margin="5" Grid.Row="1" 
                x:Name="bord"
                BorderBrush="#FFEF6803" BorderThickness="4"
                Background="Transparent">
            
            <ListBox BorderBrush="Transparent" ItemsSource="{Binding Path=PropertyVMs}"
                 Margin="2" ItemContainerStyle="{DynamicResource PropertyItemStyle}"
                 Background="Transparent" HorizontalAlignment="Stretch">
                <ListBox.Resources>
                    <Style x:Key="PropertyItemStyle" TargetType="{x:Type ListBoxItem}">
                        <Setter Property="Margin" Value="4"/>
                        <Setter Property="HorizontalAlignment" Value="Stretch"/>
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                    </Style>
                </ListBox.Resources>
            </ListBox>
        </Border>

    </Grid>
</UserControl>
